import Vue from 'vue'
import VueRouter from 'vue-router'
// import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)

const routes = [
  // {
  //   path: '/',
  //   name: 'home',
  //   component: HomeView
  // },
  // {
  //   path: '/about',
  //   name: 'about',
  //   // route level code-splitting
  //   // this generates a separate chunk (about.[hash].js) for this route
  //   // which is lazy-loaded when the route is visited.
  //   component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  // }
  {
    path: '/',
    redirect: '/poetry'
  },
  {
    path: '/sentence',
    component: () => import('../views/sentence.vue'),
    meta: {
      title: '励志句子'
    }
  },
  {
    path: '/chickensoup',
    component: () => import('../views/chickensoup.vue'),
    meta: {
      title: '毒鸡汤'
    }
  },
  {
    path: '/poetry',
    component: () => import('../views/poetry.vue'),
    meta: {
      title: '一句诗词'
    }
  }
]

const router = new VueRouter({
  routes
})

router.beforeEach((to,from,next) => {
  window.document.title = to.meta.title;
  next();
})

export default router
